Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deglob

Package Overview
Dependencies
Maintainers
7
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deglob

Take a list of glob patterns and return an array of file locations, respecting `.gitignore` and allowing for ignore patterns via `package.json`.

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
151K
decreased by-19.97%
Maintainers
7
Weekly downloads
 
Created

What is deglob?

The deglob npm package is used to expand glob patterns into an array of file paths, with options to ignore certain patterns and to use specific file extensions. It is particularly useful for tools that need to process files based on patterns, such as linters or build systems.

What are deglob's main functionalities?

Basic Usage

This feature allows you to expand a glob pattern into an array of file paths. In this example, it will find all JavaScript files in the current directory and its subdirectories.

const deglob = require('deglob');

deglob(['**/*.js'], (err, files) => {
  if (err) {
    console.error(err);
    return;
  }
  console.log(files);
});

Ignoring Patterns

This feature allows you to specify patterns to ignore. In this example, it will find all JavaScript files but ignore those in the 'node_modules' and 'dist' directories.

const deglob = require('deglob');

deglob(['**/*.js'], { ignore: ['node_modules/**', 'dist/**'] }, (err, files) => {
  if (err) {
    console.error(err);
    return;
  }
  console.log(files);
});

Using Specific File Extensions

This feature allows you to specify multiple file extensions in the glob pattern. In this example, it will find all JavaScript and JSX files.

const deglob = require('deglob');

deglob(['**/*.{js,jsx}'], (err, files) => {
  if (err) {
    console.error(err);
    return;
  }
  console.log(files);
});

Other packages similar to deglob

Keywords

FAQs

Package last updated on 23 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc